$(function () {
    getHot()
    // 获取热门推荐
    function getHot() {
        $.ajax({
            method: 'GET',
            url: 'http://localhost:3000/posts/recommend',
            success: function (res) {
                console.log(res);
                var htmlStr2 = template('hot', { data: res })
                $('.tuijian').html(htmlStr2)
                // console.log(htmlStr2);
            }
        })
    }
    getIdArt()
    // // 根据id获取文章
    function getIdArt() {
        var id = window.location.href.split('?')[1].split('=')[1]
        // var review;
        $.ajax({
            method: 'GET',
            url: 'http://localhost:3000/posts/' + id,
            success: function (response) {
                console.log(response);
                var htmlStr4 = template('juti', response)
                $('#article').html(htmlStr4)
                // console.log(htmlStr4);
            }
        })
    }
})